package org.xinjiang.data.migration.xinjiang.contorller;

import com.baomidou.mybatisplus.core.metadata.IPage;
import io.swagger.annotations.Api;
import io.swagger.v3.oas.annotations.Operation;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import org.xinjiang.data.migration.common.response.PageInfo;
import org.xinjiang.data.migration.common.response.Param;
import org.xinjiang.data.migration.common.response.Result;
import org.xinjiang.data.migration.xinjiang.dto.req.XjJzdxQueryDTO;
import org.xinjiang.data.migration.xinjiang.dto.res.XjJzdxResultDTO;
import org.xinjiang.data.migration.xinjiang.dto.res.XjSubJzdxResultDTO;
import org.xinjiang.data.migration.xinjiang.service.IXjJzdxService;

/**
 * @Description: 新疆矫正对象
 */
@Api(tags = "新疆矫正对象")
@RestController
@RequestMapping("/xinjiang/jzdx")
@Slf4j
public class XjJzdxController {
    @Autowired
    private IXjJzdxService xjJzdxService;


    /**
     * 分页列表查询
     *
     * @return
     */
    @Operation(summary = "新疆矫正对象-分页列表查询")
    @PostMapping(value = "/pageList")
    public Result<PageInfo<XjJzdxResultDTO>> pageList(Param pageable, @Validated @RequestBody XjJzdxQueryDTO dto) {
        PageInfo<XjJzdxResultDTO> pageList = xjJzdxService.pageList(pageable, dto);
        return Result.ok(pageList);
    }

    /**
     * 手工sql实现分页列表查询
     *
     * @return
     */
    @Operation(summary = "新疆矫正对象-手工sql实现分页列表查询")
    @PostMapping(value = "/findPageList")
    public Result<IPage<XjSubJzdxResultDTO>> findPageList(Param pageable, @Validated @RequestBody XjJzdxQueryDTO dto) {
        IPage<XjSubJzdxResultDTO> pageList = xjJzdxService.findPageList(pageable, dto);
        return Result.ok(pageList);
    }
}
